<form id="form_quotes_showedit" method="post" action="y.php?r=quotes/savedata">
    <input type="hidden" name="quotes_id" value="">
    <input type="hidden" name="potentials_id" value=""/>
    <table class="tab_form">
        <tr>
            <td><input class="easyui-textbox" name="quotes_number" data-options="label:'报价单:',required:true"></td>
            <td><select class="easyui-combobox" name="stage" id="form_quotes_showedit_stage"
                        data-options="label:'状态:',required:true,url:'y.php?r=middle/picklist/getdata&picklistkey=stage&picklistvalue=<?php echo $quotes['stage']; ?>',valueField:'id',textField:'text'">
                </select></td>
            <td><input class="easyui-textbox" id="form_quotes_showedit_potentials_name"  data-options="label:'销售机会:',required:true,value:'<?php echo $quotes['potentials_name']; ?>'" />
                <a href="#" class="easyui-linkbutton fr" data-options="iconCls:'icon-search'" onclick="loadWin2('选择销售机会','y.php?r=potentials/select&form=form_quotes_showedit')" >选择</a>
            </td>
        </tr>
        <tr>
            <td><input class="easyui-textbox" name="total" data-options="label:'总价:',required:true"></td>
            <td><input class="easyui-datetimebox" name="quotetime"
                       data-options="label:'报价时间:',required:true"></td>
            <td></td>
        </tr>
    </table>
</form>
<div style="text-align:center;padding:5px 0">
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">清空</a>
</div>
<script>
    var dataobj = <?php echo json_encode($quotes) ?>;
    $(function () {
        $('#form_quotes_showedit').form('load', dataobj);
    });
    function submitForm() {
        $('#form_quotes_showedit').form('submit', {
            success: function () {
                $('#win_main').window("close");
                $("#quotes_list").datagrid("reload");
            }
        });
    }
    function clearForm() {
        $('#form_quotes_showedit').form('clear');
        $('#texteditor_content').texteditor("clear")
        if (dataobj != null) {
            $("input[name=quotes_id]").val(dataobj.quotes_id);
            $("input[name=potentials_id]").val(dataobj.potentials_id);
        }
    }
</script>